package org.caenv.interpreter;

import java.io.PrintStream;
import java.io.PrintWriter;

public class ExecutionException extends Exception {

    private final Exception exception;

    public ExecutionException(Exception exception) {
        this.exception = exception;
    }

    public Exception getException() {
        return this.exception;
    }

    @Override
    public String getMessage() {
        return super.getMessage() + "\n" + this.exception.getMessage();
    }

    @Override
    public String toString() {
        return super.toString() + "\n" + this.exception.toString();
    }

    @Override
    public void printStackTrace(PrintWriter writer) {
        super.printStackTrace(writer);
        this.exception.printStackTrace(writer);
    }

    @Override
    public void printStackTrace(PrintStream stream) {
        super.printStackTrace(stream);
        this.exception.printStackTrace(stream);
    }

    @Override
    public void printStackTrace() {
        super.printStackTrace();
        this.exception.printStackTrace();
    }

    @Override
    public String getLocalizedMessage() {
        return super.getLocalizedMessage() + "\n" + this.exception.getLocalizedMessage();
    }

    @Override
    public Throwable getCause() {
        return this.exception.getCause();
    }

    @Override
    public synchronized Throwable fillInStackTrace() {
        return this.exception.fillInStackTrace();
    }

    @Override
    public void setStackTrace(StackTraceElement[] stes) {
        this.exception.setStackTrace(stes);
    }

    @Override
    public synchronized Throwable initCause(Throwable thrwbl) {
        return this.exception.initCause(thrwbl);
    }

    @Override
    public StackTraceElement[] getStackTrace() {
        return this.exception.getStackTrace();
    }
    
}
